﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Windows.Forms;
//using System.Drawing;
//using System.Drawing.Imaging;

//namespace FlickrDownloadr
//{
//    public class ProgressIcon : Control
//    {
//        public ProgressIcon()
//        {
//            _timer = new System.Threading.Timer(new System.Threading.TimerCallback(Tick), null, 0, 100);
//            _img = Properties.Resources.Progress;

//            this.SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true);
//        }

//        System.Threading.Timer _timer;
//        int _tick;
//        Bitmap _img;

//        private void Tick(object obj)
//        {
//            if (_tick == 17)
//                _tick = 0;

//            _tick++;

//            Invalidate();
//        }

//        protected override void OnPaintBackground(PaintEventArgs e)
//        {
//            base.OnPaintBackground(e);

//            Graphics g = e.Graphics;

//            int x = _tick * 20;

//            ImageAttributes attr = new ImageAttributes();
//            attr.SetColorKey(_img.GetPixel(0, 0), _img.GetPixel(0, 0));

//            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
//            g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
//            g.DrawImage(_img, new Rectangle(0, 0, 20, 20), x, 0, 20, 20, GraphicsUnit.Pixel, attr);
//        }
//    }
//}
